class Question implements java.lang.Comparable {
	Questionnaire questionnaire
	String content
	String type
	int multiSelect
	Calendar creationTime = Calendar.getInstance()
	SortedSet questionItems
	SortedSet answers

	static mapping = {
		table 'VOTING_QUESTION'
	}

	static belongsTo = Questionnaire
	static hasMany = [questionItems: QuestionItem, answers: Answer]

    static constraints = {
		content(blank:false, maxSize: 5000)
		type(blank:false, maxSize: 255)
		multiSelect(blank:false)
    }

	static optionals = {
	}

	String toString() {
		"${this.content}"
	}

	int compareTo(Object q){
		this.creationTime.compareTo(q.creationTime)
	}
}
